Digital Adaptive Feedforward Harmonic Distortion Compensation for Digitally Controlled Power Stage

ABSTRACT

Systems and method to compress digital video based on human factors expressed as a desirability score are provided. A particular method includes passing a digital input signal through a pulse-width modulator and passing an output of the pulse-width modulator through a power switching device. An output of the power switching device has a plurality of pulses. The method includes receiving the output of the power switching device at a first input of a comparator and receiving a reference voltage at a second input of the comparator. The method includes determining a net signal based on an output of the comparator and determining a timing error signal based on the net signal and the digital input signal. The method also includes adjusting the digital input signal to compensate for harmonic distortion based at least in part on the timing error signal.

PRIORITY CLAIM

This application is a continuation of, and claims priority from, U.S. patent application Ser. No. 11/198,383, filed Aug. 5, 2005 and entitled “DIGITAL ADAPTIVE FEEDFORWARD HARMONIC DISTORTION COMPENSATION FOR DIGITALLY CONTROLLED POWER STAGE,” which claims priority under 35 USC §119 from U.S. Provisional Application No. 60/600,477, filed Aug. 11, 2004, each of which is hereby incorporated by reference in its entirety.

FIELD OF THE DISCLOSURE

The present disclosure relates to digital adaptive feedforward harmonic distortion compensation for digitally controlled power stage.

BACKGROUND

In recent years, a pulse width modulation (PWM) Class D digital audio amplifier has been of great interest within the consumer electronics industry due to its superior power efficiency compared to traditional Class A, Class B and Class AB analog amplifiers. Class D amplifiers have been designed with a digital input source and use digital signal processing (DSP) to convert the pulse code modulation (PCM) audio data into PWM data to drive an appropriate power device. However, the output audio quality of such a digital amplifier has not increased along with the increased efficiency. This is mainly due to PWM induced distortion and various errors and noise disturbances that occur in different functional blocks of a digital Class D amplifier (e.g., timing errors that happen in the power stage switching devices), quantization noises, and power supply disturbances.

Methods and algorithms have been invented to reduce the PWM induced distortion such as described in U.S. Pat. No. 5,617,058 to Adrian, U.S. Pat. No. 6,657,566 to Risbo and U.S. Pat. No. 5,559,467 to Smedley. For a typical power device, disturbances in power supply and timing errors caused by switching characteristics are usually the dominant sources of harmonic distortion at the output. Correction methods and circuits, such as that taught in Smedley, were designed specifically to compensate the power supply errors and variations. In general, previous attempts at correcting total harmonic distortion (THD) for digital amplifiers utilized analog feedback from the switching power stage into various topologies.

An analog feedback loop in a digital input amplifier requires either the use of a high-speed feedback circuitry or the use of a high-precision/high-speed A/D converter Both of these choices require sensitive and precise electronics that are difficult to design and are expensive to implement in an integrated circuit (IC). With a well-regulated power supply or using other means of correcting for power supply errors, the level of distortion is determined mainly by the timing errors occurring in the power stage. Thus, it becomes possible to digitize the output of the switching power stage, not with a traditional multi-bit analog-to-digital (A/D) converter, but rather a simple comparator circuit that outputs only a two-level, binary signal. This conversion can be performed simply and cheaply in standard complimentary metal-oxide semiconductor (CMOS) digital IC processes. Since the power switch is driven directly by a digital signal, it is a simple operation to derive the timing error of the power switch.

SUMMARY

The present disclosure relates to an apparatus and method for reducing harmonic distortion in output signals of digital-input switching audio amplifiers. The disclosure relates to digitally generating the harmonic components having the same magnitude but opposite phase as the output harmonic distortion in an effort to create an anti-distortion signal to correct the input signal and adapting the anti-distortion signal based on the power stage timing error. The disclosure describes amplifier embodiments and methods that allow for compensation of distortion caused by switching power stages and allows for improved THD performance of the output signals.

In an embodiment, digital timing read back and an adaptive feedforward compensation algorithm are applied to reduce the harmonic distortion. More specifically, this approach generates the harmonic components digitally with the same magnitude but at an opposite phase to the output harmonic distortion. That is, to generate an anti-distortion signal and add it to the input signal. The magnitude and phase of the harmonic distortion change with the modulation level or index and the frequency of the input signal. In addition, the harmonic distortion level varies significantly with different timing error statistics in different power devices. The method takes the modulation level or index, the frequency of the input signal, and the timing error statistics acquired through a digital read back circuit as input variables to determine the magnitude and phase of the anti-distortion signal. The variables of the compensation signal can also be adjusted for individual systems to compensate for fixed errors other than the power switch timing errors, such as errors caused by printed circuit board (PCB) layout and component selection of both the switching power stage and low-pass filter. The compensation for errors of the low-pass filter is significant as most methods using analog feedback use a feedback signal before the low-pass filter and cannot correct for these errors. Currently most all-digital amplifier solutions utilize a chip-set solution, with a digital CMOS controller IC and a separate power switch IC. Methods of the present disclosure can function with any power switch IC, can function with any discrete power switch design such as audio and motor control, or can function as a single-IC solution containing both a controller and power device.

Analysis shows that dependence of harmonics on amplitude, frequency, and timing errors can be accounted for in separate stages. The ability to segment the error components may significantly simplify an overall compensation algorithm. For example, it is possible to generate a compensation signal first to correspond to the input amplitude, followed by an adjustment with respect to the timing error statistics, and then another adjustment according to the input frequency. Since the timing error statistics vary between different power devices, it may be necessary to capture the statistical variations and update the compensation signal adaptively.

All of the adjustments of the compensation signal regarding the amplitude, frequency and timing error variations, and data acquisitions can be accomplished by various methods (e.g., a Fast Fourier transform (FFT) computation unit or spectrum analyzer, a defined polynomial model, or a look up table process). Among these approaches, using a look up table with linear interpolations for intermediate entries is appealing for simplicity, high efficiency, and low cost. The look up table contains a set of reference values of harmonic distortion magnitudes and phases, timing errors, and the adaptation parameters for frequency and timing error variations at a few different input levels. To create the entries in the look up table, harmonic magnitudes and phases are first measured for each of the predetermined modulation levels. Similarly, the timing information at the output of the power device is measured and compared to the input of the power stage. The difference is defined as the timing error, and the statistics such as mean and variance of the error may be calculated from the measurements. The adaptation parameters are a set of known constant values derived from offline analysis based on data collected from a number of sample systems.

After the compensation, the signal goes through the conventional interpolation, noise shaping and PWM processes before it drives the power device to switch on and off. The output of the power device is usually lowpass filtered and delivered to a speaker load as presented in the art.

From a systematic view, the input signal first goes through an estimation block to estimate the amplitude (the modulation level or index) and the frequency of the input signal. Then, based on the estimated values, a set of harmonic coefficients will be retrieved from a look-up-table and adjusted according to the amplitude, then to the read back statistics from the power device, and finally to the frequency. The digitally generated harmonic samples will be added to the input signal in the harmonic compensation process. Then, the samples get up-sampled, noise shaped and pulse width modulated before it drives the power device to switch on and off. Finally, the output of the power device is low-pass filtered and delivered to the output load.

In a particular embodiment, a digital audio amplifier includes a switching power stage. The digital audio amplifier includes a pulse width modulator coupled to the switching power stage. The digital audio amplifier also includes a controller. The controller includes at least one comparator to receive an output of the switching power stage. The at least one comparator generates a comparator output. The comparator output is at least partially determined by the output of the switching power stage and a reference voltage. The controller includes at least one digital counter configured to receive the comparator output. The at least one digital counter is configured to count a width of one or more pulses in the comparator output and to determine a net pulse signal. The controller also includes a circuit in communication with the at least one digital counter. The circuit compares a signal derived from an input signal to the pulse width modulator to the net pulse signal to generate an error signal to be used for harmonic distortion compensation.

In a particular embodiment, a method to provide compensation for harmonic distortion in a digital audio amplifier includes passing a digital input signal through a pulse-width modulator. The method includes passing an output of the pulse-width modulator through a power switching device. An output of the power switching device has a plurality of pulses. The method includes receiving the output of the power switching device at a first input of a comparator and receiving a reference voltage at a second input of the comparator. The method includes determining a net signal based on an output of the comparator and determining a timing error signal based on the net signal and the digital input signal. The method also includes adjusting the digital input signal to compensate for harmonic distortion based at least in part on the timing error signal.

In a particular embodiment, a method of compensating for harmonic distortion in a digital audio amplifier includes estimating an initial phase and an amplitude of an input signal. The method includes passing an output of a pulse-width modulator through a power switching device. An output of the power switching device has a plurality of pulses, where each pulse has a width. The method includes receiving the output of the power switching device at a first input of a comparator and receiving a reference voltage at a second input of the comparator. The method includes determining, based on an output of the comparator, a net signal. The method includes comparing the net signal to a pulse-width modulator input signal to determine an error signal. The error signal is at least partially derived from a power stage responsive to the input signal. The method includes determining at least one harmonic coefficient of the input signal from the estimated initial phase, the estimated amplitude of the input signal, and the error signal. The method includes updating a look-up table based on the error signal and the at least one harmonic coefficient. The method also includes modifying the input signal based at least in part on the at least one harmonic coefficient.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a system diagram of adaptive digital feedforward harmonic compensation according to an embodiment of the disclosure.

FIG. 2 illustrates a flowchart of a frequency and magnitude estimation according to an embodiment of the disclosure.

FIG. 3 illustrates a diagram of a read back circuit according to an embodiment of the disclosure.

FIG. 4 illustrates the THD performance of the prototype system according to an embodiment of the disclosure.

FIG. 5 illustrates FFT of an output signal without harmonic distortion compensation.

FIG. 6 illustrates FFT of an output signal with harmonic distortion compensation according to an embodiment of the disclosure.

DETAILED DESCRIPTION

Turning to FIG. 1, a system diagram of an illustrative embodiment of an adaptive feedforward harmonic compensation algorithm is depicted. A source or signal generator 100 sends a signal to an Amplitude and Frequency Estimation Module 102 where the modulation level and the frequency of the input signal is initially determined based on estimated values. Next, the Harmonic Compensation module 104 determines the harmonic coefficients of the estimated signal by retrieving the values from a look-up table contained in the Look-up Table and Processing Module 118. The coefficients are adjusted based on the magnitude of the signal and added to the signal in the Harmonic Compensation Module 104.

After the Harmonic Compensation module 104, the signal is passed through an interpolator 106 and a noise shaper 108, before the signal is pulse width modulated by a pulse width modulator 110. The signal then arrives to drive a switching power stage 112. The output of the switching power stage 112 is low-pass filtered by lowpass filter 116 before it is delivered to a load 120. The timing information from the pulses of the switching power stage 112 is fed to a Read Back Circuit 114 to minimize the THD of the system.

The Read Back Circuit 114, shown in more detail in FIG. 3, receives the PWM pulses from the switching power stage 112 and sends the signal, after processing, to the Look-up Table and Processing Module 118. The Look-up Table and Processing Module 118 processes both the output of the Read Back Circuit 114 and the Amplitude and Frequency Estimation Module 102 to more accurately define the coefficients stored in the look-up table.

Turning now to FIGS. 2A and 2B, an embodiment of a flowchart of a Frequency/Amplitude Estimation 102 algorithm is presented. Amplitude and frequency estimation is important because the harmonic distortion levels change with input amplitude and frequency. For a sine wave, the frequency and period of a sinusoidal signal can be estimated by the zero-crossing detection method, because the time interval between two consecutive zero-crossing instants equals one half of a cycle of the sinusoidal signal. For more complex input signals, a spectrum analyzer or Fourier analysis unit can be used to acquire the frequency components and the corresponding amplitudes. For convenience, a sine wave input has been assumed throughout this embodiment. In digital applications, exact zero-crossing may not be captured for each cycle of the input signal due to a finite sampling rate or a non-integer oversampling ratio. However, if the oversampling ratio is fairly large, which is true for most digital audio applications, we may approximate the zero-crossing time instants as the point in time where we detect that the two consecutive samples either equal zero or have opposite signs. Therefore, it is straightforward to estimate the period of the sinusoidal signal with this approach. The frequency is the inverse of the estimated period. To avoid division operations in real-time implementations, an alternative frequency estimation procedure is presented as follows.

In an illustrative embodiment, to estimate the frequency and magnitude, an input signal 100 is first compared to a maximum amplitude, max_A, at 122. When the amplitude of the input signal 100 is greater than the maximum amplitude, the input magnitude is set to equal the maximum amplitude, at 124. When the input amplitude is less than or equal to the maximum amplitude, the value is unchanged. A determination is made whether the input signal 100 has zero-crossed, at 126, according to the algorithm depicted in FIG. 2B.

As shown in FIG. 2B variables r1 and r2 are initialized to zero, at 128. When the value of the input signal 100 at a previous time (t−1) is positive or zero, at 130, then r1 is set to one, at 134. When the input signal at time t−1 is negative, then r1 is set to a negative one, at 132. When the current value of the input signal 100 at time t is positive or zero, at 136, then the variable r2 is set to equal negative one, at 138. When the input signal 100 at time t is negative, then r2 is set to equal one, at 140. Then, r1 and r2 are multiplied, at 142. When the result is positive, the input signal 100 during the time interval from t−1 to t has crossed zero. When the product of r1 and r2 is negative or zero, the input signal 100 has not crossed zero.

Turning back to FIG. 2A at 126, when the output of the zero-crossed function from FIG. 2B indicates the input signal 100 has crossed zero, at 126, that is the input signal has crossed zero between the time of t−1 and t, then the amplitude is set to equal the maximum amplitude and a normalized frequency is calculated, at 150. A counter and the maximum amplitude are also set to zero, at 150. When the output value of the zero-crossed function from FIG. 2B indicates the input signal has not crossed zero, at 126, the value of the input signal 100 is unchanged. The input signal 100 is then analyzed by a harmonic compensation algorithm, at 104. The input signal 100 is sent to a PWM Module, at 110. The counter is incremented by one, at 154. A determination is made whether the cycle has ended, at 156. When the cycle has not ended, the input signal 100 is fed back to the beginning of the beginning of the cycle. When the cycle has ended, the method proceeds to an exit, at 158.

To calculate the normalized frequency, assume a sinusoidal input signal with unity amplitude (the normalized sinusoidal signal as explained below) described by the equation x(t)=sin(2πft). The derivative of x(t) with respect to t is

$\frac{{x(t)}}{t} = {2\pi \; f\; {{\cos \left( {2\pi \; f\; t} \right)}.}}$

Thus, the frequency f is given by

$f = {{Maximum}{\; \;}\frac{1}{2\pi}{\left\{ {\frac{{x(t)}}{t}} \right\}.}}$

and the normalized frequency, defined as the inverse of the oversampling ratio, is

$\frac{f}{f_{s}} = {{{Maximum}\mspace{14mu} \frac{1}{2\pi \; f_{s}}\left\{ {\frac{{x(t)}}{t}} \right\}} = {{Maximum}\mspace{14mu} \frac{1}{2\pi}{T \cdot {\left\{ {\frac{{x(t)}}{t}} \right\}.}}}}$

where f_(s) is the sampling frequency and

$T = \frac{1}{f_{s}}$

is the sampling interval. The derivative of x(t) at t=kT can be numerically approximated by the 3^(rd) order finite difference formula as

$\begin{matrix} {{{\frac{{x(t)}}{t} = {\frac{1}{T}\left\{ {{h_{0}{x\lbrack k\rbrack}} + {h_{1}{x\left\lbrack {k - 1} \right\rbrack}} + {h_{2}{x\left\lbrack {k - 2} \right\rbrack}}} \right\}}},{{{at}\mspace{20mu} t} = {kT}},{where}}{{h_{0} = \frac{3}{2}},{h_{1} = {- 2}},{h_{2} = {\frac{1}{2}.}}}} & \left( {{Eq}.\mspace{14mu} 1} \right) \end{matrix}$

Therefore, the normalized frequency is given by

$\begin{matrix} {{{\frac{f}{f_{s}} = {{Maximum}{\left\{ {{{\frac{3}{4\pi} \times \lbrack k\rbrack} - {\frac{1}{\pi} \times \left\lbrack {k - 1} \right\rbrack} + {\frac{1}{4\pi} \times \left\lbrack {k - 2} \right\rbrack}}} \right\}.{Since}}}},{{x(t)} = {{\sin \left( {2\pi \; f\; t} \right)}\mspace{14mu} {and}}}}{\frac{{x(t)}}{t} = {2\pi \; f\; {\cos \left( {2\pi \; f\; t} \right)}}}} & \left( {{Eq}.\mspace{14mu} 2} \right) \end{matrix}$

have a 90 degree phase difference, it is easy to see that the maximum of

$\frac{{x(t)}}{t}$

occurs at t₀ when x(t₀)=0, that is, the zero-crossing instant for x(t).

The algorithm for the estimation of the period and normalized frequency of the input sinusoidal signal is summarized as follows.

(1). If the k th sample x[k]=0 or the sign of x[k] is opposite to the sign of x[k−1], let t₁=k; (2). Compute the normalized frequency:

${\frac{f}{f_{s}}\left\{ {{{\frac{3}{4\pi} \times \left\lbrack t_{1} \right\rbrack} - {\frac{1}{\pi} \times \left\lbrack {t_{1} - 1} \right\rbrack} + {\frac{1}{4\pi} \times \left\lbrack {t_{1} - 2} \right\rbrack}}} \right\}};$

(3). Repeat (1) unless another zero crossing time instant t₂ is found; and (4). The period of the input x(t) is then 2(t₂−t₁) samples.

An amplitude of the input, A, can be determined using known algorithms. A simple moving average filter that approximates a root mean square (RMS) amplitude of the signal can be used to find the amplitude of the input signal. The RMS of the amplitude more closely matches how the human ear perceives the amplitude. A peak sine method may be implemented, however the RMS method is an improvement that better matches the perception of music heard by human ears. The RMS amplitude will work both for correcting constant sine wave sources such as are used in lab testing and for music signals that will be used when listening to an amplifier.

After the Amplitude and Frequency Estimation Module 102 of FIG. 1, the Harmonic Compensation Module 104 computes the harmonic components of the input signal 100. A particular embodiment employs the following algorithm in the computation of the harmonics of input signals. For convenience, it is assumed that the input signal 100 is a sine wave with an initial phase of zero. The harmonics of such a sine wave can be computed by using trigonometry formulas. To reduce the computational complexity in the digital domain, the input signal 100 is first normalized to have an amplitude of 1. The normalization is to multiply 1/A to the input sample A*sin(2πfkT) and obtain the k th sample of the normalized input signal, X=sin(2πfkT). After A (0<A≦1) is estimated from the Amplitude and Frequency Estimation module 102, a Newton-Raphson algorithm is applied to calculate 1/A in an iterative way with only addition and multiplication operations. More specifically, a first function is defined:

$\begin{matrix} {{{f(z)} = {\frac{1}{z} - A}},} & \left( {{Eq}.\mspace{14mu} 3} \right) \end{matrix}$

and the computation of 1/A becomes equivalent to search for the solution to f(z)=0. The Newton-Raphson algorithm states that the root of f(z) is given by the following recursive equation:

$\begin{matrix} {{z_{i + 1} = {z_{i} - \frac{f\left( z_{i} \right)}{f^{\prime}\left( z_{i} \right)}}},} & \left( {{Eq}.\mspace{14mu} 4} \right) \end{matrix}$

where z_(i) is the i th trial and f′(z) is the derivative of f(z). The iterative solution to 1/A is given by substituting Eq. 3 into Eq. 4 to give:

$\begin{matrix} \begin{matrix} {{z_{i + 1} = {z_{i}\left( {2 - {Az}_{i}} \right)}},} \\ {{= {2{z_{i}\left( {1 - {\frac{A}{2}z_{i}}} \right)}}},{i = 1},2,\ldots} \end{matrix} & \left( {{Eq}.\mspace{14mu} 5} \right) \end{matrix}$

An initial trial value, R, for the iterative algorithm is chosen based on the estimation of A for fast convergence, and four iterations provides sufficient accuracy. To implement the normalization process in a fixed-point operation, A is scaled up by 2^(N) (N=10 for this embodiment). The iterative algorithm is illustrated as the following virtual code:

A=A*2̂N;

For i=1:4

a=R*A;

b=a/2;

c=1−b;

d=R*c;

R=d*2;

End

R=R*2̂N,

The value of R at the end of the iteration is approximately 1/A. After the normalization, the quadrate signal Y=cos(2πfkT), is first computed as:

$\begin{matrix} {Y = {{\cos \left( {2\pi \; f\; {kt}} \right)} = {{\frac{1}{2\pi \; f}\frac{{x(t)}}{t}\mspace{14mu} {at}\mspace{14mu} t} = {{kT}.}}}} & \left( {{Eq}.\mspace{14mu} 6} \right) \end{matrix}$

The derivative of x(t) at t=kT can be numerically approximated by (Eq. 1). Therefore:

$\begin{matrix} \begin{matrix} {Y = {\frac{f_{s}}{2f}\left\{ {{\frac{3}{2\pi}{x\lbrack k\rbrack}} - {\frac{2}{\pi} \times \left\lbrack {k - 1} \right\rbrack} + {\frac{1}{2\pi} \times \left\lbrack {k - 2} \right\rbrack}} \right\}}} \\ {= {\left( {t_{2} - t_{1}} \right){\left\{ {{\frac{3}{2\pi} \times \lbrack k\rbrack} - {\frac{2}{\pi} \times \left\lbrack {k - 1} \right\rbrack} + {\frac{1}{2\pi} \times \left\lbrack {k - 2} \right\rbrack}} \right\}.}}} \end{matrix} & \left( {{Eq}.\mspace{14mu} 7} \right) \end{matrix}$

Given X and Y, the higher order harmonics are computed using the multiple angle formulas as follows:

$\begin{matrix} {X_{2} = {{\sin \left( {4\pi \; f\; {kT}} \right)} = {2{XY}}}} & \left( {{Eq}.\mspace{14mu} 8} \right) \\ {Y_{2} = {{\cos \left( {4\pi \; f\; {kT}} \right)} = {1\; 2X^{2}}}} & \left( {{Eq}.\mspace{14mu} 9} \right) \\ {X_{3} = {{\sin \left( {6\pi \; f\; {kT}} \right)} = {4{X\left( {\frac{3}{4} - X^{2}} \right)}}}} & \left( {{Eq}.\mspace{14mu} 10} \right) \\ {Y_{3} = {{\cos \left( {6\pi \; f\; {kT}} \right)} = {4{Y\left( {\frac{1}{4} - X^{2}} \right)}}}} & \left( {{Eq}.\mspace{14mu} 11} \right) \\ {X_{4} = {{\sin \left( {8\pi \; f\; {kT}} \right)} = {2X_{2}Y_{2}}}} & \left( {{Eq}.\mspace{14mu} 12} \right) \\ {Y_{4} = {{\cos \left( {8\pi \; f\; {kT}} \right)} = {{2Y_{2}^{3}} - 1}}} & \left( {{Eq}.\mspace{14mu} 13} \right) \\ {X_{5} = {{\sin \left( {10\pi \; f\; {kT}} \right)} = {{2Y_{2}X_{2}} - X}}} & \left( {{Eq}.\mspace{14mu} 14} \right) \\ {Y_{4} = {{\cos \left( {10\pi \; f\; {kT}} \right)} = {{Y\left( {\frac{Y_{4}}{4} - {X^{2}Y_{2}}} \right)}4}}} & \left( {{Eq}.\mspace{14mu} 15} \right) \end{matrix}$

If the corresponding phase for the i th harmonic is θ_(i), the compensating signal becomes

C _(i) =g _(i)(X _(i) cos(θ_(i))+Y _(i) sin [(θ_(i))]  (Eq. 16)

where g_(i) is the magnitude of the harmonic.

Turning now to FIG. 3, a block diagram of the Read Back Circuit 114 is depicted. A feedback circuit is designed to acquire the timing information of the pulses in a power device. Though the feedforward method is applicable without the Read Back Circuit 114 and will lower the THD of the system, the inclusion of the Read Back Circuit 114 and adaptation of generated harmonics, in this embodiment, will better reduce the THD over a number of systems. First, the Read Back Circuit 114 uses a voltage divider 160 to convert the high-voltage PWM pulses from the output of a switching power stage 112 into a low-voltage signal which is appropriate for the low voltage CMOS ICs to process. Rectangular PWM pulses at the input of the switching power stage 112 are usually distorted as they flow through a power device. For example, due to the charge and discharge characteristics of the switching power stage 112, the output pulses are more likely to have trapezoidal shapes with finite rising and falling edges instead of purely rectangular shapes. As commonly adopted, a time interval between 50% levels on rising edges and falling edges is measured as a pulse width. This is accomplished by using a pair of comparators 164, contained within a digital controller IC 174, to re-shape the pulse waveforms by comparing low-level logic pulses with a DC reference voltage. The DC reference voltage can be a constant voltage or can be derived from a power supply in order to track any changes in voltage that may occur to the power supply. The re-shaped rectangular pulses are fed into a digital counter 166 to count the widths of these pulses. The digital counter 166 is running at the same digital clock frequency or higher than are PWM output counters. There are two pulses per channel, when using the damped ternary Adrian patent method that enter independent counters comprising the positive and negative pulses corresponding to the two outputs of the full-bridge power stage. The difference of the two counters gives a net pulse signal that the switching power stage 112 has output. This method can also be modified to obtain the timing errors of a binary modulation using either a full-bridge or half-bridge power stage by recording the pulse widths of two consecutive pulses. The output of the noise-shaper 108 is delayed by delay line 168 by the number of cycles required for output of the PWM module 110 and input of the Read Back Circuit 114 signals. This delayed output from the noise shaper 108 is compared at a comparator 170 to a net signal from net signal calculation 172 from the Read Back Circuit 114 every PWM output cycle. The difference between these two signals is the timing error of the switching power stage 112. It has been found that time resolution of 5 nanoseconds of the digital counters 166 is necessary to significantly increase the performance of current power device ICs. Smaller time resolutions detect smaller timing errors and perform better.

The total harmonic distortion at the output is related to the timing error of the pulses in the switching power stage 112. Based on collected power stage error data from the Read Back Circuit 114 the following linear equations can be used to describe the correlation between the timing errors and individual harmonic amplitudes reasonably well:

H ₂ =a ₂ VE+b ₂,  (Eq. 17)

H ₃ =a ₃ DE+b ₃,  (Eq. 18)

H ₄ =a ₄ DE ⁴ +b ₄,  (Eq. 19)

H ₅ =a ₅ VE+b ₅,  (Eq. 20)

where VE is the variance of the net timing error E, and DE is the mean of the net timing error magnitude without the DC offset, that is MEAN(|E-MEAN(E)|). In one embodiment, the harmonic distortion coefficients g₂ g₃, g₄, g₅ and the corresponding timing error statistics VE_ref and DE_ref of a reference power device are stored in a look-up-table as an initial point of the adaptation process. When the timing error statistics change, the adaptation of harmonic compensation will be applied using the above equations as follows:

g ₂ ′=g ₂ +a ₂(VE−VE _(ref)),  (Eq. 21)

g ₃ ′=g ₃ +a ₃(DE−DE _(ref)),  (Eq. 22)

g ₄ ′=g ₄ +a ₄(DE ⁴−(DE _(ref))⁴),  (Eq. 23)

g ₅ ′=g ₄ +a ₅(DE−DE _(ref)),  (Eq. 24)

To obtain the statistics of DE and VE, a first-order recursive moving average filter is used:

${{H(Z)} = \frac{1 - \alpha}{1 - {\alpha \; Z^{- 1}}}},$

a is chosen as

$\alpha = \frac{4096}{4097}$

so that the transfer function of H(Z) is equivalent to the one that averages 4096 samples over a moving window. H(Z) is applied to a net error signal E, the error magnitude without the DC offset |E-MEAN(E)|, and E². The variance of E is therefore, VE=MEAN(E²)−(MEAN(E))².

A look-up-table (LUT) in the LUT and Processing Module 118 (shown in FIG. 1) is used to contain a magnitude, a phase, and adaptive parameter values for each harmonic. It is possible to design an output stage that is capable of computing the magnitudes and phases of the harmonics from the output waveform (e.g., an A/D converter followed by a FFT engine) as an alternative method to a LUT. In such a design, the system will start up from an all-zero initial state and automatically calibrate the feed-forward correction coefficients based on the feedback readings from the output stage in a short period of time. A LUT is favorable because of simplicity, high efficiency, and much lower cost. The values in the LUT are acquired and processed from lab measurements over a reasonable number of sample systems. Generation of the coefficients requires applying the various parameters that the entries in the LUT represent, such as different amplitudes and frequencies of these signals. While each LUT entry is being output, the amplitudes of the harmonics are recorded via an audio measurement system, at the same time the VE and DE values of the Read Back Circuit 114 are recorded via digital communications with the controller 174 (shown in FIG. 3). After several systems have been measured it becomes possible to calculate the VE_ref and DE_ref LUT values, which are the mean values for the VE and DE read over the tested systems for each particular LUT entry. It also becomes possible to calculate the harmonic amplitudes and phases at the VE_ref and DE_ref values, which can be obtained directly from lab measurements. The adaptation values will be computed using a linear square fitting model. An example for the second harmonic adaptation coefficient can be found below:

$\begin{matrix} {{a_{z} = \frac{{L{\sum\limits_{i = 1}^{L}{H_{zi}V\; E_{1}}}} - {\sum\limits_{i = 1}^{L}{H_{zi}{\sum\limits_{i = 1}^{L}{V\; E_{1}}}}}}{{L{\sum\limits_{i = 1}^{L}{V\; E_{1}^{2}}}} - \left( {\sum\limits_{i = 1}^{L}{V\; E_{1}}} \right)^{2}}},} & \left( {{Eq}.\mspace{14mu} 25} \right) \end{matrix}$

where i represents the different systems tested from 1 to L, H and VE represent the read values of the second harmonic amplitude and VE. This is repeated for the higher order harmonics. The higher the number of systems tested the more accurate the adaptation coefficients become.

The frequency adaptation is computed by measuring the harmonic amplitudes at the base frequency (f₀) and the high frequency (f₁). In this embodiment the high frequency is set at 5 kHz, but this frequency is arbitrary. The equation for generating the frequency adaptation parameter for the second harmonic is:

$\begin{matrix} {P_{2} = {\left( {H_{2}^{\prime} - H_{2}} \right)*\frac{f_{s}}{f_{1} - f_{0}}}} & \left( {{Eq}.\mspace{14mu} 26} \right) \end{matrix}$

where H₂′ is the harmonic amplitude at f₁ and H₂ is the harmonic amplitude at f₀. Below f₀ the standard a₂ value is used, whereas above f₀ the a₂ value is modified using linear interpolation based on the detected frequency and value of P₂. This method is repeated for higher order harmonics. The frequency adaptation parameter is stored separately in the LUT as it is independent of amplitude and therefore only requires one entry. By adjusting the LUT values for a particular system design it becomes possible to not only compensate for the variable power switch timing errors but also for other fixed errors that may occur due to PCB layout or component selection in both the switching power stage 112 and output low-pass filter 116 sections of the hardware design. For example, other non-ideal components or distortions for mismatch in the system may be compensated. The values for the LUT can therefore either be stored in ROM in the digital controller IC for pre-determined power ICs and system designs or downloaded from a system micro-controller to internal RAM at start-up for custom or new power ICs and system designs.

Based on the estimated amplitude, the process searches for the corresponding entries for the harmonic coefficients, phases and adaptive parameter values and computes the new harmonic coefficients with the read back timing errors. Table 1 illustrates the structure of an embodiment of a LUT used to compensate the i th harmonic.

TABLE 1 Structure of the Look-Up-Table Am- i th plitude R Harmonic Slope Phase VE_ref DE_ref Adaptation A₁ R₁ g_(1i) s_(1i) Ph_(1i) VE₁ DE₁ a_(1i) A₂ R₂ g_(2i) s_(2i) Ph_(2i) VE₂ DE₂ a_(2i) . . . . . . . . . . . . . . . . . . . . . . . . A_(n) R_(n) g_(ni) s_(ni) Ph_(ni) VE_(n) DE_(n) a_(ni)

The first column of the table is the amplitude entries which can be predetermined with specific spacing. Any spacing of amplitude entries is valid however, and can be selected for optimal performance from the power output and THD characteristics across the amplitude of the system. The second column contains the approximated inverse of the corresponding amplitude, R_(n), for normalization process use. The third column records the harmonic distortion coefficients of a reference system corresponding to the amplitude entries. The fourth column contains the slope of the harmonic coefficients between the consecutive amplitude entries for the purpose of linear interpolations. The fifth column is the phase information for the corresponding harmonic tone, in the form of cosine and sine values. VE_ref is the variance of the timing error of the switching device and DE_ref is the mean magnitude of the timing error subtracted from its own average. The last column is the adaptation coefficients which are used to adjust the harmonic coefficients from the reference system due to the differences in timing error statistics.

When the estimated amplitude is between two entry indexes, a linear interpolation is used to compute the corresponding harmonic coefficients. For example, if the estimated amplitude A is between A₁ and A₂, the i th harmonic coefficient will be interpolated as:

g _(i) =g _(1i) +s _(1i)*(A−A ₁)  (Eq. 27)

For the phase and adaptation parameters, it is more efficient to use the values corresponding to the amplitude which is closest to the estimated amplitude. For example, if A is again between A₁ and A₂, and |A−A₁|≦|A₂−A|, meaning that A is closer to A₁ than to A₂, then we may use Ph_(1i), VE₁, DE₁, and a_(1i) as the phase and adaptation parameters for the i th harmonic.

The harmonic magnitude is also related to the input signal 100 frequency. From measured real data, frequency dependence can be approximately represented by a linear equation. For a fixed amplitude A, the magnitude of the i th harmonic is approximately given by:

g _(i) ′=p _(i)(A)*f+a _(i)  (Eq. 28)

By selecting a specific frequency f₀ (for example, f₀=1 kHz) as reference, the harmonic at frequency f for amplitude A will be:

g _(i) ′=g _(i0) ′+p _(i)(A)*(f−f ₀),  (Eq. 29)

where g_(i0)′ is the harmonic magnitude after the amplitude and timing error adjustments (Eqs. 21-24 and 27). Further analysis shows that the frequency factor p_(i)(A) is a linear function of the amplitude A. Similarly, by selecting an amplitude A₀ (for example, A₀=−20 dBFS) as reference, p_(i)(A) is given by:

p _(i)(A)=p _(i)(A ₀)+(A−A ₀)*k _(i),  (Eq. 30)

where k_(i) is the linear parameter that corrects the frequency compensation component, or frequency factor (p_(i)), as a function of the amplitude of the input signal. Therefore, the final harmonic magnitude, adjusted with respect to amplitude, timing error statistics and frequency for the i th harmonic, is given by:

g _(i) ′=g _(i0)′+(f−f ₀)*[p _(i)(A ₀)*k _(i)],  (Eq. 31)

The frequency adaptation coefficients are computed by measuring the harmonic amplitudes at the base frequency (f₀) and the high frequency (f₁) at amplitude A₀. In the case of this embodiment, we will mark the high frequency (f₁) at 5 kHz and the amplitude A₀ at −20 dB from full-scale. The variable f_(s) represents the sampling frequency of the audio data at the point the correction is performed. The equation for generating the frequency adaptation parameter for the second harmonic is:

$\begin{matrix} {{P_{2} = {\left( {H_{2}^{\prime} - H_{2}} \right)*\frac{f_{s}}{f_{1} - f_{0}}}},} & \left( {{Eq}.\mspace{14mu} 32} \right) \end{matrix}$

Where H₂′ is the harmonic amplitude at f₁ and H₂ is the harmonic amplitude at f₀. The amplitude is then changed to A₁, in this example being −10 dB. At A₁ the harmonic amplitude is again measured at f₀ and f₁, with respective values H₂″ and H₂″′. These values are then input into the equation to calculate the second frequency adaptation parameter, k₂.

$\begin{matrix} {k_{2} = \frac{\left\lbrack {{\left( {H_{2}^{\prime\prime\prime} - H_{2}^{\prime\prime}} \right)*\frac{f_{s}}{f_{1} - f_{0}}} - P_{2}} \right\rbrack}{A_{1} - A_{0}}} & \left( {{Eq}.\mspace{14mu} 33} \right) \end{matrix}$

The frequency adaptation parameter is stored separately in the LUT as it is independent of amplitude and therefore only requires one entry.

The LUT and Processing Module 118, in one embodiment, can be summarized as performing the following steps:

(1). Determine the entry point of the LUT based on the estimated amplitude; (2). Read the harmonic coefficients and interpolate the harmonic magnitudes g_(i) with the estimated amplitude; (3). Read the adaptation values and compute the harmonic magnitudes g_(i0)′ using the adaptation equations and the read back information; (4). Update the harmonic magnitude using the frequency adjustment equation to get g_(i)′; (5). Read the phase information of the harmonics; and (6). Complete the harmonic generation and compensate the input signal 100.

An illustrative embodiment is implemented with a digital signal processor (DSP) and field programmable gate array (FPGA) development tools. For example, a DSP processor, such as an Analog Device ADSP-21161 and a FPGA device such as an Altera Stratix can be used. The DSP takes the digital data from an audio precision source, passes it through the Amplitude and Frequency Estimation Module 102, Read Back Circuit 114 and adaptation, then through the Harmonics Compensation Module 104 to digitally generate the harmonics and compensate the input signal 100 accordingly. The system then interpolates the signal using interpolator 106 and performs noise shaping using noise shaper 108 to filter the data before it is passed to the FPGA. The FPGA receives the data from the DSP and uses a digital counter 166 (shown in FIG. 3) to generate rectangular PWM pulses using PWM modulator 110, which is to drive the switching power stage 112. The FPGA also receives the read back signal from the feedback circuit and counts the width of the signal pulse and the compensation pulse, calculating the net output signal by taking the difference of the two. This net signal is sent to the DSP and the DSP further processes the signal to get the error and the corresponding statistics such as DE_ref and VE_ref of the error that will be used for the adaptations. The DDX-2060 or DDX-2100 switching power stage, available from Apogee Technology, Inc. of Norwood, Mass., can be used at the power stage in the set-up to support both stereo and mono applications. Because the timing error changes from device to device, twelve test boards can be assembled with DDX-2060 and DDX-2100 chips that have different lot numbers and therefore production times to form a set of sample space. With the collected data from the twelve boards, the correlation between the harmonic coefficients and timing error statistics are analyzed to obtain the adaptation parameters.

Turning now to FIG. 4, a sample plot of the results of an illustrative embodiment is shown. The graph plots the THD versus output power. A corrected signal 176 is shown in relation to the same input signal without corrections to the distortion 178. The corrected signal 176 contains significantly less distortion than the uncorrected signal 178. Implementation of this embodiment with a 5 ns read back resolution yields an absolute limit for the total harmonic distortion plus noise (“THD+N”) performance to around 0.01-0.02%. FIG. 5 and FIG. 6 depict a Fast Fourier Transform (“FFT”) plot of the same input signal 100 before and after the corrections, respectively. Across the frequency range shown, the output of the corrected signal 182 in FIG. 6 shows a general decrease in THD yielding a maximum THD reduction of approximately 16-18 dB from the uncorrected signal 180 of FIG. 5. The data depicted in FIG. 4-6 was generated from a prototype platform. A non-prototype system is expected to yield better results as the prototype platform had a noise limitation much lower than the known performance, limiting the THD+N from noise. The prototype has a measured signal-to-noise ratio (SNR) of 92 dB compared to over 100 dB SNR measured in current ICs.

Although the present embodiments are depicted herein as having a separate digital controller and switching power device hardware, those skilled in the art should appreciate that the embodiments could also be implemented through a single integrated circuit solution, that is the digital controller and switching power device could be implemented in a single IC.

Although the embodiments detailed herein utilize a normalized sinusoidal input signal with zero phase, one skilled in the art should appreciate that a multitude of input signals (e.g., multi-tone or music input, and non-unity amplitude signals) could be implemented without deviating from the present teachings. Additionally methods such polynomial modeling or Fourier analysis can be applied to compute the harmonics and/or the inter-modulation products.

Although the present embodiments depict a Read Back Circuit that applies a subtraction or difference calculation to adapt the signal in the comparators, one skilled in the art should recognize that other comparisons or measurements could be taken of the signal without deviating from the present teachings.

Although the LUT described in the present embodiments catalogs the values of the variables listed in Table 1, one skilled in the art should recognize that any data useful for signal processing may be collected and stored in the structure of the table without deviating from the present teachings.

One or more embodiments of the disclosure may be referred to herein, individually and/or collectively, by the term “invention” merely for convenience and without intending to voluntarily limit the scope of this application to any particular invention or inventive concept. Moreover, although specific embodiments have been illustrated and described herein, it should be appreciated that any subsequent arrangement designed to achieve the same or similar purpose may be substituted for the specific embodiments shown. This disclosure is intended to cover any and all subsequent adaptations or variations of various embodiments.

The Abstract of the Disclosure is provided with the understanding that it will not be used to interpret or limit the scope or meaning of the claims. In addition, in the foregoing Detailed Description, various features may be grouped together or described in a single embodiment for the purpose of streamlining the disclosure. This disclosure is not to be interpreted as reflecting an intention that the claimed embodiments require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive subject matter may be directed to less than all of the features of any of the disclosed embodiments. Thus, the following claims are incorporated into the Detailed Description, with each claim standing on its own as defining separately claimed subject matter.

The above-disclosed subject matter is to be considered illustrative, and not restrictive, and the appended claims are intended to cover all such modifications, enhancements, and other embodiments, which fall within the scope of the present invention. Thus, to the maximum extent allowed by law, the scope of the present invention is to be determined by the broadest permissible interpretation of the following claims and their equivalents, and shall not be restricted or limited by the foregoing detailed description. 

1. A digital audio amplifier, comprising: a switching power stage; a pulse width modulator coupled to the switching power stage; and a controller comprising: at least one comparator to receive an output of the switching power stage, the at least one comparator generating a comparator output, the comparator output at least partially determined by the output of the switching power stage and a reference voltage; at least one digital counter configured to receive the comparator output, the at least one digital counter configured to count a width of one or more pulses in the comparator output and to determine a net pulse signal; and a circuit in communication with the at least one digital counter, the circuit comparing a signal derived from an input signal to the pulse width modulator to the net pulse signal to generate an error signal to be used for harmonic distortion compensation of the input signal.
 2. The digital audio amplifier of claim 1, further comprising a low pass filter coupled to the switching power stage and a load coupled to the low pass filter.
 3. The digital audio amplifier of claim 1, wherein the controller comprises a delay line to delay the signal derived from the input signal by a number of cycles so that the circuit compares a portion of the input signal that corresponds to the net pulse signal.
 4. The digital audio amplifier of claim 3, wherein the circuit subtracts the net pulse signal from the signal derived from the input signal to generate the error signal.
 5. The digital audio amplifier of claim 1, wherein the controller comprises a processing module that receives the error signal and uses the error signal to populate a look-up table for use with respect to the harmonic distortion compensation of the input signal.
 6. The digital audio amplifier of claim 1, wherein the at least one digital counter comprises a first counter that counts positive pulses of the output of the switching power stage and a second counter that counts negative pulses of the output of the switching power stage, wherein the net pulse signal is determined by a difference of the first counter and the second counter.
 7. The digital audio amplifier of claim 1, wherein the controller comprises a voltage divider to receive the output of the switching power stage and to provide a low-voltage signal output to the at least one comparator.
 8. The digital audio amplifier of claim 7, wherein the at least one comparator re-shapes the low-voltage signal output from the voltage divider by comparing the low-level voltage signal output from the voltage divider to a direct current (DC) reference voltage.
 9. The digital audio amplifier of claim 8, wherein the DC reference voltage is derived from a power supply.
 10. The digital audio amplifier of claim 1, wherein the error signal corresponds to a timing error of the switching power stage.
 11. The digital audio amplifier of claim 1, wherein a time resolution of the at least one digital counter is less than or equal to about 5 nanoseconds.
 12. A method to provide compensation for harmonic distortion in a digital audio amplifier, the method comprising: passing a digital input signal through a pulse-width modulator; passing an output of the pulse-width modulator through a power switching device, an output of the power switching device having a plurality of pulses; receiving the output of the power switching device at a first input of a comparator; receiving a reference voltage at a second input of the comparator; determining a net signal based on an output of the comparator; determining a timing error signal based on the net signal and the digital input signal; and adjusting the digital input signal based at least in part on the timing error signal to compensate for harmonic distortion.
 13. The method of claim 12, further comprising converting the output of the power switching device from a high voltage signal to a low voltage signal.
 14. The method of claim 12, wherein determining the timing error signal comprises subtracting the net signal from the digital input signal.
 15. The method of claim 12, wherein determining the net signal comprises counting positive and negative pulses in the output of the comparator.
 16. The method of claim 12, wherein the digital input signal passes through a noise shaper prior to the determination of the timing error signal.
 17. A method of compensating for harmonic distortion in a digital audio amplifier, the method comprising: estimating an initial phase and an amplitude of an input signal; passing an output of a pulse-width modulator through a power switching device, an output of the power switching device having a plurality of pulses each having a width; receiving the output of the power switching device at a first input of a comparator; receiving a reference voltage at a second input of the comparator; determining, based on an output of the comparator, a net signal; comparing the net signal to a pulse-width modulator input signal to determine an error signal, the error signal at least partially derived from a power stage responsive to the input signal; determining at least one harmonic coefficient of the input signal from the estimated initial phase, the estimated amplitude of the input signal, and the error signal; updating a look-up table based on the error signal and the at least one harmonic coefficient; and modifying the input signal based at least in part on the at least one harmonic coefficient.
 18. The method of claim 17, further comprising: passing the modified input signal through an interpolator to produce an interpolated signal; noise-shaping the interpolated signal to produce a noise-shaped signal; pulse-width modulating the noise-shaped signal to produce a pulse-width modulated signal; driving the power stage with the pulse-width modulated signal; and low-pass filtering an output of the power stage to provide an output deliverable to a load.
 19. The method of claim 17, wherein modifying the input signal comprises adding the at least one harmonic coefficient to the input signal.
 20. The method of claim 17, wherein determining the at least one harmonic coefficient of the input signal comprises interpolating the at least one harmonic coefficient from two harmonic coefficients stored in the look-up table. 